import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_draw/p10/pic_man_page.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  // 横屏显示
  SystemChrome.setPreferredOrientations(
      [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
  // 全屏显示
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
  runApp(const PicManApp());
}

class PicManApp extends StatelessWidget {
  const PicManApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PicMan',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.only(top: 58, left: 20),
          child: Center(
            child: Wrap(
              spacing: 20,
              runSpacing: 20,
              children: buildChildren(),
            ),
          ),
        ),
      ),
    );
  }

  List<Widget> buildChildren() => List<Widget>.generate(
      6,
      (index) => PicMan(
            color: Colors.lightBlue,
            angle: (1 + index) * 6.0,
          ));
}
